<template>
    <Modal :mask-closable="false" class="modal-title-layout" v-model="show" :title="`${$t('maintenance.Deleteremind')}`">
        <div class="icon red">
            <i class="iconfont zy-common-shanchu"></i>
        </div>
        <p class="title">
            <span>{{ $t('common.sureDelete') }}</span>
        </p>
        <div slot="footer">
            <Button type="default" @click="show = false">{{ $t('common.Cancle') }}</Button>
            <Button type="primary" @click="onSubmit">{{ $t('maintenance.Confirmed') }}
            </Button>
        </div>
    </Modal>
</template>

<script>
export default {
  name: "deleteModal",
  props: {
    submit: {
      type: Function,
      default: () => {}
    }
  },
    data(){
        return {
            show:false
        }
    },
    methods:{
        showModal(obj){
            this.show = true;
            if (obj){
              const { submit } = obj
              if (submit && typeof submit === "function"){
                this.onSubmit = ()=>{
                  this.show = false
                  submit()
                }
              }
            }
        },
        onSubmit(){
          if (this.submit){
            this.$emit('submit')
            this.show = false
          }
        }
    }
}
</script>

<style scoped>

</style>
